package com.yqya.springboot.shiro.practice.biz.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yqya.springboot.shiro.practice.biz.PermissionInfoBizService;
import com.yqya.springboot.shiro.practice.domain.PermissionInfo;
import com.yqya.springboot.shiro.practice.dto.PermissionInfoDTO;
import com.yqya.springboot.shiro.practice.service.PermissionInfoService;

import cn.hutool.core.date.DateUtil;

/**
 * 角色信息业务服务接口实现类
 *
 * @author Kevin
 * @date 2019-07-28
 */
@Service
public class PermissionInfoBizServiceImpl implements PermissionInfoBizService {

    @Autowired
    private PermissionInfoService permissionInfoService;

    @Override
    public PermissionInfo save(PermissionInfoDTO dto) {
        String code = dto.getCode();
        String name = dto.getName();

        PermissionInfo item = new PermissionInfo();
        item.setCode(code);
        item.setName(name);
        item.setCreateTime(DateUtil.date());
        permissionInfoService.save(item);

        return item;
    }

}
